package router

import (
	"github.com/gin-gonic/gin"

	"mxshop-api/shared/auth"
	"mxshop-api/userop-web/api/address"
	"mxshop-api/userop-web/global"
)

func InitAddressRouter(router *gin.RouterGroup) {
	signingKey := global.ServerConfig.SigningKey
	AddressRouter := router.Group("/address").Use(auth.Middleware(signingKey))
	{
		AddressRouter.GET("", address.List)          // 查看地址
		AddressRouter.POST("", address.New)          // 新增地址
		AddressRouter.PUT("/:id", address.Update)    // 更新地址
		AddressRouter.DELETE("/:id", address.Delete) // 删除地址
	}
}
